improve: do not close infra client if same as client#3187
Merged
csviri merged 2 commits intooperator-framework:nextfrom Feb 26, 2026
Merged
improve: do not close infra client if same as client#3187csviri merged 2 commits intooperator-framework:nextfrom
csviri merged 2 commits intooperator-framework:nextfrom
Conversation
This makes isses in case that the client is explicitly set - typically in KubeApiTest. But after first test it closes client, so other tests are not able to run. Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a client lifecycle management issue in the LocallyRunOperatorExtension where the infrastructure Kubernetes client was being closed unconditionally after each test, even when it was the same instance as the operator's client. This caused problems when running multiple tests with an explicitly set client, as the first test would close the shared client making it unavailable for subsequent tests.
Changes:
- Add conditional check before closing infrastructure client to prevent double-closing when both clients reference the same instance
- Add explanatory comment describing the lifecycle management logic
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...ework-junit/src/main/java/io/javaoperatorsdk/operator/junit/LocallyRunOperatorExtension.java
Outdated
Show resolved
Hide resolved
...ework-junit/src/main/java/io/javaoperatorsdk/operator/junit/LocallyRunOperatorExtension.java
Outdated
Show resolved
Hide resolved
…ator/junit/LocallyRunOperatorExtension.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
xstefank
reviewed
Feb 26, 2026
Collaborator
xstefank
left a comment
There was a problem hiding this comment.
But where do we close the infra client then?
metacosm
approved these changes
Feb 26, 2026
Collaborator
Author
Here we close it if it is not the same as the standard client |
csviri
added a commit
that referenced
this pull request
Feb 28, 2026
--------- Signed-off-by: Attila Mészáros <a_meszaros@apple.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
csviri
added a commit
that referenced
this pull request
Mar 6, 2026
--------- Signed-off-by: Attila Mészáros <a_meszaros@apple.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This makes isses in case that the client is explicitly set - typically in KubeApiTest.
But after first test it closes client, so other tests are not able to run.
Signed-off-by: Attila Mészáros a_meszaros@apple.com